package com.yixin.my.proj.service.impl;

import com.yixin.my.proj.dao.UserDao;
import com.yixin.my.proj.domain.User;
import com.yixin.my.proj.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User login(User user) {
        User existUser = userDao.getByUserName(user.getUsername());
        if (existUser != null){
            if (existUser.getPassword().equals(user.getPassword())){
                return user;
            }
        }
        return null;
    }

}
